Crate gix_config

source ·
Expand description

gix_config

This crate is a high performance git-config file reader and writer. It exposes a high level API to parse, read, and write git-config files.

This crate has a few primary offerings and various accessory functions. The table below gives a brief explanation of all offerings, loosely in order from the highest to lowest abstraction.

OfferingDescriptionZero-copy?
FileAccelerated wrapper for reading and writing values.On some reads1
parse::StateSyntactic events for git-config files.Yes
value wrappersWrappers for git-config value types.Yes

This crate also exposes efficient value normalization which unescapes characters and removes quotes through the normalize_* family of functions, located in the value module.

Known differences to the git config specification

  • Legacy headers like [section.subsection] are supposed to be turned into to lower case and compared case-sensitively. We keep its case and compare case-insensitively.

Feature Flags

  • serde — Data structures implement serde::Serialize and serde::Deserialize.

  1. When read values do not need normalization and it wasn’t parsed in ‘owned’ mode. 

Modules

  • A high level wrapper around a single or multiple git-config file, for reading and mutation.
  • This module handles parsing a git-config file. Generally speaking, you want to use a higher abstraction such as File unless you have some explicit reason to work with events instead.

Structs

  • Any value that can be interpreted as a boolean.
  • Any value that may contain a foreground color, background color, a collection of color (text) modifiers, or a combination of any of the aforementioned values, like red or brightgreen.
  • High level git-config reader and writer.
  • Any value that can be interpreted as an integer.
  • Any value that can be interpreted as a path to a resource on disk.

Enums

  • A list of known sources for git configuration in order of ascending precedence.